package ctd.util.xml.jaxb;

import ctd.util.converter.DateConverter;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.util.Date;

/**
 * Created by jinxin on 2016/7/27.
 */
public class DateTimeAdapter extends XmlAdapter<String,Date>{
    @Override
    public Date unmarshal(String dateStr) throws Exception {

        return DateConverter.StringToDateTime(dateStr);
    }

    @Override
    public String marshal(Date date) throws Exception {

        return DateConverter.DateTimeToString(date);
    }
}
